import axios from 'axios'
import service from './axios-config'
import { SERVER_URL } from './config'

// 查询天气
// https://apia.aidioute.cn/weather/
// http://www.tianqiapi.com/api?version=v9&appid=23035354&appsecret=8YvlPNrz
export function getSkyQuery() {
  return axios({
    method: 'POST',
    url: `http://v1.yiketianqi.com/free/week?unescape=1&appid=47644364&appsecret=lvbKvzw8&city=台州`,
    responseType: 'json',
    contentType: 'application/json'
  })
}

// 查询学校基础信息
export function getBasicQuery(data) {
  return service({
    method: 'POST',
    url: `${SERVER_URL}/v1/yl/basic/info/query`,
    responseType: 'json',
    contentType: 'application/json',
    data
  })
}

// 查询人闸进出数据
export function getPunchQuery(data) {
  return service({
    method: 'POST',
    url: `${SERVER_URL}/v1/yl/punch/record/query`,
    responseType: 'json',
    contentType: 'application/json',
    data
  })
}

// 查询人闸进出统计
export function getPunchQueryCount(data) {
  return service({
    method: 'POST',
    url: `${SERVER_URL}/v1/yl/punch/record/queryCount`,
    responseType: 'json',
    contentType: 'application/json',
    data
  })
}

// 查询车闸进出查询
export function getCarQuery(data) {
  return service({
    method: 'POST',
    url: `${SERVER_URL}/v1/yl/car/record/query`,
    responseType: 'json',
    contentType: 'application/json',
    data
  })
}

// 查询车闸进出统计
export function getCarQueryCount(data) {
  return service({
    method: 'POST',
    url: `${SERVER_URL}/v1/yl/car/record/queryCount`,
    responseType: 'json',
    contentType: 'application/json',
    data
  })
}

// 查询车闸记录数
export function getCarQueryCountByPlate(data) {
  return service({
    method: 'POST',
    url: `${SERVER_URL}/v1/yl/car/record/queryCountByPlate`,
    responseType: 'json',
    contentType: 'application/json',
    data
  })
}

// 
export function getCameraPlayUrl(data) {
  return service({
    method: 'POST',
    url: `https://yinlun-dahua-icc.tengw.cn/v1/rtsp/view`,
    responseType: 'json',
    contentType: 'application/json',
    data
  })
}

// 监控列表
export function getDeviceQuery(data) {
  return service({
    method: 'POST',
    url: `https://yinlun-dahua-icc.tengw.cn/v1/device/query`,
    responseType: 'json',
    contentType: 'application/json',
    data
  })
}


// 电子围栏折线图
export function getElectronicQueryStatics (data) {
  return axios({
    method: 'POST',
    url: `${SERVER_URL}/v1/yl/electronic/fence/queryStatics`,
    responseType: 'json',
    contentType: 'application/json',
    data: data
  })
}

// 电子围栏
export function getElectronicQuery (data) {
  return axios({
    method: 'POST',
    url: `${SERVER_URL}/v1/yl/electronic/fence/query`,
    responseType: 'json',
    contentType: 'application/json',
    data: data
  })
}

// 电子围栏
export function getElectronicRead (data) {
  return axios({
    method: 'POST',
    url: `${SERVER_URL}/v1/yl/electronic/fence/read`,
    responseType: 'json',
    contentType: 'application/json',
    data: data
  })
}

// 登录
export function getUserLogin (data) {
  return axios({
    method: 'POST',
    url: `${SERVER_URL}/v1/yl/basic/info/login`,
    responseType: 'json',
    contentType: 'application/json',
    data: data
  })
}